1. Field of the Invention
This invention relates to performance monitoring; and in particular, this invention relates to dynamically computing a degradation analysis of waiting threads in a virtual machine.
2. Description of the Related Art
A Java application program executes in a Java Virtual Machine on a computer system. A Java Virtual Machine (JVM) is a software machine which executes on the hardware of a physical machine, that is, a computer system. In other words, the JVM is a software simulation of a machine. The JVM takes as its program input a stream of bytes, referred to as bytecode, that represent execution code provided by a programming language, then simulates that program's execution one bytecode at a time. Programs that are written in a language that produces this bytecode are called Java application programs.
Multiple Java application programs can execute concurrently in the JVM. An operating system is software which executes on the computer system which manages the resources of the computer system. The Java application programs which are executing within the JVM typically compete with each other for operating system resources. As part of this competition, various ones of the Java application programs may wait in queues while needed resources are unavailable and do not continue executing until these resources are become available. While waiting, the Java application program does no productive work and its ability to complete the task-at-hand is degraded. A certain amount of waiting may be acceptable for Java application programs. However, when the amount of time spent waiting becomes excessive or if the number of times that waits occur exceeds a reasonable amount, the Java application program may not be programmed correctly to take advantage of the available resources. When this happens, the delay caused by the waiting Java application programs elongates the response time experienced by an end user. An enterprise may use Java application programs to perform various functions. Delays based on abnormal degradation consume employee time and may be costly to corporations.
FIG. 1 depicts a portion of an exemplary Java application program 12. The program logic of the Java application program comprises one or more Java instructions 14. Each line of a Java application program 12 is associated with a line number 16. One or more Java instructions may be on a line. The program logic of a Java application program 12 comprises one or more classes and each class comprises one or more Java methods. An exemplary Java method called handleNewConnection starts on line 401, and another exemplary Java method called hello starts on line 437. A Java instruction produces one or more bytecodes.
A Java thread is a unit of operation in a JVM. The JVM may divide the program logic of the Java application program into portions which can execute concurrently on separate threads. Therefore each Java application program may be executed using one or more threads. The threads are independent and execute concurrently. During execution, sometimes one portion of the Java application program executing on one thread needs to wait for execution to complete on another portion of the Java application program which is executing on another thread. There may be various reasons for a portion of a program to wait. Some reasons for waiting are not problematic, and other reasons may indicate a problem.
Therefore, there is a need to detect when a Java application program is waiting and to determine the reason(s) for causing the Java application program to wait.